<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ page import = "com.project.model.Food"%>
<%@ page import = "com.project.control.FoodControl"%>
<%@page import="com.project.util.ParamUtil;"%>
<html>
	<head>
		<title>修改动态</title>
	</head>
	<body>
		<%
				request.setCharacterEncoding("UTF-8");
				FoodControl hc = new FoodControl();
				int id = Integer.parseInt(request.getParameter("id"));
				String title = request.getParameter("title");
				String addtime = request.getParameter("addtime");
				int type = Integer.parseInt(request.getParameter("type"));
				String content = request.getParameter("content1");
				String editor = request.getParameter("editor");
				String original = request.getParameter("original");
				
				Food food = new Food();
				food.setAddtime(addtime);
				food.setEditor(editor);
				food.setOriginal(original);
				food.setTitle(title);
				food.setType(type);
				food.setContent(content);
				if (hc.updateFood(food, id)) {
		%>
	<script language = "javascript">
	if(window.confirm("更新成功！"))
	window.location.href = "food.jsp";
	else
	window.location.href = "food.jsp";
	</script>
	<%} else { %>
	<script language="javascript">
	if(window.confirm("更新失败！"))
	window.location.href = "food.jsp";
	else
	window.location.href = "food.jsp";
	</script>
		<%
	  		}
		%>
	</body>
</html>